// 防抖
const debounce= (fn:any, delay:number)=> {
    let timer:any=null
    return function () {
      timer&&clearTimeout(timer)
      timer = setTimeout(() => {
        fn()
      }, delay)
    }
}
// 节流
function throttle (fn:any, delay:any) {
    var isThtottle:any=null;
    return () => {
      if (isThtottle) return
      isThtottle = setTimeout(() => {
        fn()
        isThtottle = null
      }, delay)
    }
}
export {debounce,throttle}